﻿<Window x:Class="ReportingManagement.Components.Queries.QueryParametersCreator"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:query="clr-namespace:GenericTools.CustomReporting;assembly=GenericTools"
             mc:Ignorable="d" Width="500" MaxHeight="720"  SizeToContent="Height" Title="Query Parameter Editors"
             d:DesignHeight="300" d:DesignWidth="450" ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <ListBox Margin="10" x:Name="lstParameters" HorizontalContentAlignment="Stretch" 
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0">
            <ListBox.Resources>
                <Style TargetType="{x:Type ListBox}">
                    <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue" />
                </Style>
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="IsTabStop" Value="False" />
                </Style>
            </ListBox.Resources>
            <ListBox.ItemContainerStyle>
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="Focusable" Value="False" />
                </Style>
            </ListBox.ItemContainerStyle>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border BorderThickness="0,0,0,5" Margin="0,0,0,10">
                        <Border.BorderBrush>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStop Offset="0" Color="Gray" />
                                <GradientStop Offset="1" Color="LightGray" />
                            </LinearGradientBrush>
                        </Border.BorderBrush>
                        <Grid Margin="2">
                            <Grid.Resources>
                                <Style TargetType="{x:Type Label}">
                                    <Setter Property="Margin" Value="0,0,5,0" />
                                    <Setter Property="Padding" Value="0" />
                                </Style>
                                <Style TargetType="{x:Type TextBox}">
                                    <Setter Property="Background" Value="#FFFAFAFF" />
                                    <Setter Property="Margin" Value="0,0,0,5" />
                                </Style>
                                <Style TargetType="{x:Type Button}">
                                    <Setter Property="Margin" Value="5,0,0,3" />
                                    <Setter Property="Padding" Value="10,3" />
                                </Style>
                                <Style TargetType="{x:Type ComboBox}">
                                    <Setter Property="Margin" Value="0" />
                                </Style>
                            </Grid.Resources>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition  />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Label Content="Name" />
                            <TextBox x:Name="txtName" Grid.Column="1" Text="{Binding Name}" FontWeight="Bold" IsReadOnly="True" IsEnabled="False" />

                            <Label Grid.Row="1" Content="Description" />
                            <TextBox x:Name="txtDescription" Grid.Row="1" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Description}" />

                            <Label Grid.Row="2" Content="Regular expression for validation" />
                            <TextBox x:Name="txtValidationExpression" Grid.Row="2" Grid.Column="1" TextWrapping="Wrap" Text="{Binding ValidationExpression}" />

                            <Label Grid.Row="3" Content="Data Type Name" />
                            <TextBox x:Name="txtDataTypeName" Grid.Row="3" Grid.Column="1" Text="{Binding DataTypeName}" />
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <Border Grid.Row="1" BorderBrush="#FFD0D0D4" BorderThickness="2" Margin="10">
            <DockPanel LastChildFill="False" Background="#FFE6E6EA">
                <Button x:Name="btnCancel" Content="Cancel" DockPanel.Dock="Right" Margin="5" Padding="15,3" IsCancel="True" />
                <Button x:Name="btnOK" Content="OK" DockPanel.Dock="Right" Margin="5" Padding="20,3" IsDefault="True" Click="btnOK_Click" />
            </DockPanel>
        </Border>
    </Grid>
</Window>
